<?php
require_once("../class/Include.class.php"); 
$obj_site = new Site(); 


#	==============================================================	#
#	TITLE, DESCRIPTION, KEYWORDS	#
#	==============================================================	#
$title = "";
$description = "";
$keywords = "";
 



?>
<!doctype html>
<html>
<head>
<?php require_once('../includes/head.php'); ?>


    
 <script type="text/javascript">
$(document).ready(function(){					

	
        $(function() {
            $(" #page_produtos_esquerda ul li").click(function()
            {
                    $("#page_produtos_esquerda ul li").removeClass("select")
                    $(this).addClass("select");
            });
        });
        
     
	
});
</script>



</head>

<body>



<div class="container">

 
	<?php require_once("../includes/topo.php"); ?>

	
    
    <div class="titulo_interna">
    	
        <h2>PRODUTOS</h2>
        
    </div>
   
  	
    <div id="page_produtos">
    
    	 <div id="page_produtos_esquerda">
         
             <ul>
                 <li class="select">
                     <a href="#filter=" title="">
                         TODOS
                     </a>
                 </li>
                 
                 <?php
                 $result = $obj_site->select("tb_categoriaproduto");
                 if (mysql_num_rows($result) > 0) {
                     while ($row = mysql_fetch_array($result)) {
                         //	VERIFICO SE TEM PRODUTOS
                        if(mysql_num_rows( $obj_site->select('tb_produtos', "AND id_categoriaproduto = '$row[0]'") ) > 0)
                        {
                         ?>
                         <li>
                             <a href="#filter=.<?php echo Util::imprime($row[url_amigavel]); ?>" title="<?php Util::imprime($row[titulo]); ?>">
                                <?php Util::imprime($row[titulo]); ?>
                             </a>
                         </li>
                        <?php
                        $dadoscategoria .= " " . $row[url_amigavel];
                        }
                        
                     }
                }
                ?>
                 
                 
             </ul>
             
             
         </div>
         
         
         
          <div id="page_produtos_direita">
          	
            	<ul class="lista_produtos">
                    
                    
                    
                    <?php
                    $result = $obj_site->select("tb_produtos");
                    if(mysql_num_rows($result) > 0)
                    {
                            while($row = mysql_fetch_array($result))
                            {                   
                            ?>

                               <li class="element <?php echo Util::troca_value_nome($row[id_categoriaproduto], "tb_categoriaproduto", "idcategoriaproduto", "url_amigavel") ?>">
                                    <a href="<?php echo Util::imprime($row[url_amigavel]); ?>" title="<?php Util::imprime($row[titulo]); ?>">

                                        <div class="produtos_image">

                                            <span class="produtos_image_sombra"></span>

                                            <img src="../uploads/tumb_<?php Util::imprime($row[imagem]); ?>" alt="<?php Util::imprime($row[titulo]); ?>" >

                                        </div>

                                        <h1><?php Util::imprime($row[titulo]); ?></h1>		

                                    </a>

                            <?php                          
                            }
                    }
                    ?>
                    
                    
                </ul>
            
          </div>
    
    </div>
	
</div>






<?php require_once("../includes/rodape.php") ?>



</body>
</html>






<script src="<?php echo Util::caminho_projeto(); ?>/jquery/isotope-site/jquery.isotope.min.js"></script>
<script src="<?php echo Util::caminho_projeto(); ?>/jquery/isotope-site/js/jquery.ba-bbq.min.js"></script>
<script>
$(function(){

var $container = $('#page_produtos_direita ul'),
	// object that will keep track of options   
	isotopeOptions = {},
	// defaults, used if not explicitly set in hash
	defaultOptions = {
		filter: '*',
		sortBy: 'original-order',
		sortAscending: false,
		layoutMode: 'masonry'
	};

var setupOptions = $.extend( {}, defaultOptions, {
	itemSelector : '.element',
});

// set up Isotope
$container.isotope( setupOptions );

var $optionSets = $('#options').find('.option-set'),
	isOptionLinkClicked = false;

// switches selected class on buttons
function changeSelectedLink( $elem ) {
	// remove selected class on previous item
	$elem.parents('.option-set').find('.selected').removeClass('selected');
	// set selected class on new item
	$elem.addClass('selected');
}


$optionSets.find('a').click(function(){
var $this = $(this);
// don't proceed if already selected
if ( $this.hasClass('selected') ) {
  return;
}
changeSelectedLink( $this );
	// get href attr, remove leading #
var href = $this.attr('href').replace( /^#/, '' ),
	// convert href into object
	// i.e. 'filter=.inner-transition' -> { filter: '.inner-transition' }
	option = $.deparam( href, true );
// apply new option to previous
$.extend( isotopeOptions, option );
// set hash, triggers hashchange on window
$.bbq.pushState( isotopeOptions );
isOptionLinkClicked = true;
return false;
});

var hashChanged = false;

$(window).bind( 'hashchange', function( event ){
// get options object from hash
var hashOptions = window.location.hash ? $.deparam.fragment( window.location.hash, true ) : {},
	// do not animate first call
	aniEngine = hashChanged ? 'best-available' : 'none',
	// apply defaults where no option was specified
	options = $.extend( {}, defaultOptions, hashOptions, { animationEngine: aniEngine } );
// apply options from hash
$container.isotope( options );
// save options
isotopeOptions = hashOptions;

// if option link was not clicked
// then we'll need to update selected links
if ( !isOptionLinkClicked ) {
  // iterate over options
  var hrefObj, hrefValue, $selectedLink;
  for ( var key in options ) {
	hrefObj = {};
	hrefObj[ key ] = options[ key ];
	// convert object into parameter string
	// i.e. { filter: '.inner-transition' } -> 'filter=.inner-transition'
	hrefValue = $.param( hrefObj );
	// get matching link
	$selectedLink = $optionSets.find('a[href="#' + hrefValue + '"]');
	changeSelectedLink( $selectedLink );
  }
}

isOptionLinkClicked = false;
hashChanged = true;
})
// trigger hashchange to capture any hash data on init
.trigger('hashchange');

});
</script>